package com.hoshiicloud.mallshop.feign;

import com.hoshiicloud.common.query.OmnipotentParam;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.goods.entity.goods.GoodsGallery;
import com.hoshiicloud.goods.entity.spu.ExtSpuTags;
import com.hoshiicloud.goods.entity.spu.SpuSalesCategory;
import com.hoshiicloud.goods.param.goods.GoodsGalleryQueryParam;
import com.hoshiicloud.goods.param.spu.SpuSalesCategoryAddParam;
import com.hoshiicloud.goods.param.spu.SpuSalesCategoryQueryParam;
import com.hoshiicloud.mallshop.feign.hystrix.ShopGoods2FeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *  2019/8/7 18:14 qry
 *   goods 域   spu-sales-category / ext-spu-tags / goods-gallery
 */
@FeignClient(name = "hoshiicloud-goods", fallback = ShopGoods2FeignServiceFallback.class)
public interface ShopGoods2FeignService {

    // ----------------------------------------↓spu-sales-category↓------------------------------------
    /**
     * 通过扩展Spu的id集合查询营销类目信息
     */
    @GetMapping("/goods/spu-sales-category/listBySpuIds")
    Response<List<SpuSalesCategory>> listSpuSalesCategoryBySpuIds(@RequestParam("spuIds") List<Long> spuIds);

    /**
     *  批量保存spu-sales-category  qry
     */
    @PostMapping("/goods/spu-sales-category/saveBatch")
    Response<Boolean> saveSpuSalesCategoryBatch(@RequestBody List<SpuSalesCategory> allSpuSalesCategory);

    /**
     *  任意条件查询营销类目信息 qry
     */
    @PostMapping("/goods/spu-sales-category/getByParam")
    Response<List<SpuSalesCategory>> getSalesCategoryByParam(@RequestBody SpuSalesCategoryQueryParam param);

    /**
     * 保存营销类目 qry
     */
    @PostMapping("/goods/spu-sales-category/save")
    Response<Boolean> spuSalesCategoryAdd(@RequestBody SpuSalesCategoryAddParam param);


    /**
     *  通过Id删除营销类目 信息
     */
    @DeleteMapping(value = "/goods/spu-sales-category/delete/{id}")
    Response<Boolean> delSalesCategory(@PathVariable("id") Long id);

    /**
     *  批量更新商品图片资源表信息
     * @param param 更新条件以及更新内容
     * @return true or false
     */
    @PostMapping(value = "/goods/spu-sales-category/updateBatch")
    Response<Boolean> updateSpuSalesCategoryBatch(@RequestBody OmnipotentParam<SpuSalesCategory> param);
    // ----------------------------------------↑spu-sales-category↑------------------------------------

















    // ----------------------------------------↓ext-spu-tags↓------------------------------------
    /**
     *  根据 id集合查询标签信息
     */
    @GetMapping("/goods/ext-spu-tags/listBySpuIds")
    Response<List<ExtSpuTags>> listExtSpuTagsBySpuIds(@RequestParam("spuIds") List<Long> spuIds);

    /**
     *  批量保存商品标签信息
     */
    @PostMapping("/goods/ext-spu-tags/saveBatch")
    Response<Boolean> saveExtSpuTagsBatch(@RequestBody  List<ExtSpuTags> allExtSpuTags);

    /**
     * 根据扩展spuid 查标签  qry
     */
    @GetMapping("/goods/ext-spu-tags/getBySpuId/{spuId}")
    Response<List<ExtSpuTags>> getExtSpuTagsBySpuId(@PathVariable("spuId") Long spuId);

    /**
     * 通过ExtSpuId删除商品标签信息
     */
    @GetMapping("/goods/ext-spu-tags/deleteBatchs/{extSpuId}")
    Response<Boolean> deleteTagBatch(@PathVariable("extSpuId") Long extSpuId);

    /**
     *  批量更新ExtSpuTags
     * @param param 更新条件以及更新值
     * @return true or false
     */
    @PostMapping("/goods/ext-spu-tags/updateBatch")
    Response<Boolean> updateExtSpuTagsBatch(@RequestBody OmnipotentParam<ExtSpuTags> param);

    /**
     *  批量删除ExtSpuTags： 物理删除
     * @param param 删除条件
     * @return true or false
     */
    @DeleteMapping("/goods/ext-spu-tags/removeBatch")
    Response<Boolean> removeExtSpuTagsBatch(@RequestBody List<OmnipotentWrapper> param);

    // ----------------------------------------↑ext-spu-tags↑------------------------------------




    // ----------------------------------------↓goods-gallery↓------------------------------------
    /**
     *  根据 extSpuId的集合 查询相册关联表信息
     */
    @PostMapping("/goods/goods-gallery/listBySpuIds")
    Response<List<GoodsGallery>> listGoodsGalleryBySpuIds(@RequestBody List<Long> spuIds);

    /**
     *  批量保存相册关联表信息
     */
    @PostMapping("/goods/goods-gallery/saveBatch")
    Response<Boolean> saveGoodsGalleryBatch(@RequestBody List<GoodsGallery> allGoodsGallery);

    /**
     *  查询相册关联表信息
     */
    @PostMapping("/goods/goods-gallery/queryGoodsGallery")
    Response<List<GoodsGallery>> queryGoodsGallery(@RequestBody GoodsGalleryQueryParam param);

    /**
     *  通过ExtSpuId批量删除相册关联信息表
     */
    @GetMapping("/goods/goods-gallery/deleteBatchs/{extSpuId}")
    Response<Boolean> deleteGalleryByExtSpuId(@PathVariable("extSpuId") Long extSpuId);

    /**
     *  批量更新商品图片资源
     * @param param 更新条件以及更新值
     * @return true or false
     */
    @PostMapping("/goods/goods-gallery/updateBatch")
    Response<Boolean> updateGoodsGalleyBatch(@RequestBody OmnipotentParam<GoodsGallery> param);

    /**
     *  批量删除GoodsGallery: 物理删除
     * @param param 删除条件
     * @return true or false
     */
    @DeleteMapping("/goods/goods-gallery/removeBatch")
    Response<Boolean> removeGoodsGalleryBatch(@RequestBody List<OmnipotentWrapper> param);

    // ----------------------------------------↑goods-gallery↑------------------------------------



}

